using System;
using System.Drawing;
using System.ComponentModel;
using System.Globalization;
using System.Windows.Forms;
using BENBUN.Properties;
using ZoneFiveSoftware.Common.Visuals;
using ZoneFiveSoftware.SportTracks.UI.Forms;

namespace BENBUN.MetaStore {
    public partial class OptionsView : UserControl {

        public OptionsView() {
            InitializeComponent();
            txtUsername.Text = Settings.Settings.ForumUsername;
            txtPassword.Text = Settings.Settings.ForumPassword;
            checkBox1.Checked = Settings.Settings.WIWPrivacy;
            trackBar1.Value = Settings.Settings.WIWPrivacyFactor;

            if (checkBox1.Checked)
            {
                trackBar1.Enabled = true;
                textBox3.Enabled = true;
            }
            else
            {

                trackBar1.Enabled = false;
                textBox3.Enabled = false;
            }
        }

        public IPageStatus Status {
            get { return null; }
        }

        public bool Modified {
            get { return false; }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public void ShowPage(string bookmark) {
            bIgnoreCtrlChanges = true;
            bIgnoreCtrlChanges = false;

         }

        public bool HidePage() {
            return true;
        }

        public void ThemeChanged(ITheme visualTheme) {
            BackColor = visualTheme.Control;
        }

        public void UICultureChanged(CultureInfo culture) {
        }

        #region Event handlers



        #endregion

        private bool bIgnoreCtrlChanges = false;

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string url = Resources.ForumURL;
            System.Diagnostics.Process.Start(url);
        }

        private void txtUsername_TextChanged(object sender, EventArgs e)
        {
            Settings.Settings.ForumUsername = txtUsername.Text;
        }

        private void txtPassword_TextChanged(object sender, EventArgs e)
        {
            Settings.Settings.ForumPassword = txtPassword.Text;
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                Settings.Settings.WIWPrivacy = true;
                trackBar1.Enabled = true;
                textBox3.Enabled = true;
            }
            else
            {
                Settings.Settings.WIWPrivacy = false;
                trackBar1.Enabled = false;
                textBox3.Enabled = false;
            }
        }

        private void trackBar1_ValueChanged(object sender, EventArgs e)
        {
            textBox3.Text = trackBar1.Value.ToString();
            Settings.Settings.WIWPrivacyFactor = (int)trackBar1.Value;
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            textBox3.Text = trackBar1.Value.ToString();
            Settings.Settings.WIWPrivacyFactor = (int)trackBar1.Value;
        }

 
     }
}